package com.graph;

public class GraphDemo {
    public static void main(String[] args) {
        Graph graph = new Graph(5);
        String vertex[]={"A","B","C","D","E"};
        for(String v:vertex){
            graph.insertVertex(v);
        }
        graph.insertEdge(0,1,1);
        graph.insertEdge(0,2,1);
        graph.insertEdge(1,2,1);
        graph.insertEdge(1,3,1);
        graph.insertEdge(1,4,1);

        graph.showGraph();
        System.out.println("深度优先遍历：");
        graph.dfs();
        System.out.println("\n广度优先遍历：");
        graph.bfs();

    }
}
